package com.kaiwukj.android.ufamily.mvp.ui.page.sys.opinion;

import androidx.annotation.NonNull;

import com.kaiwukj.android.mcas.di.scope.ActivityScope;
import com.kaiwukj.android.mcas.mvp.BasePresenter;
import com.kaiwukj.android.mcas.utils.RxLifecycleUtils;
import com.kaiwukj.android.ufamily.mvp.http.callback.ApiCallBack;
import com.kaiwukj.android.ufamily.mvp.http.utils.RxUtils;
import com.kaiwukj.android.ufamily.mvp.ui.page.sys.SystemContract;

import javax.inject.Inject;

import me.jessyan.rxerrorhandler.core.RxErrorHandler;

@ActivityScope
public class OpinionPresenter extends BasePresenter<SystemContract.Model, SystemContract.View> {

    @Inject
    RxErrorHandler mErrorHandler;

    @Inject
    public OpinionPresenter(SystemContract.Model model, SystemContract.View view) {
        super(model, view);
    }

    public void postOpinion(String content, String phone) {
        mModel.postOpinion(content, phone)
                .compose(RxUtils.schedulerHelper())
                .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
                .subscribe(new ApiCallBack<Integer>(mErrorHandler, mRootView) {
                    @Override
                    public void onSuccess(@NonNull Integer result) {

                    }
                });
    }


}
